Preface
"Everybody has a plan until they get punched in the mouth."
-Mike Tyson, undisputed heavyweight champion boxer
Soon after its creation in 2009, AngularJS grew into a widely popular foundational tool for
building frontend applications. As years and releases went by, and the JavaScript community
matured, the world of client-side programming broadened beyond what Angular was
originally designed for. Its caretakers took stock and decided that a sweeping overhaul of the
framework was in order.
AngularJS, now Angular 1, still exists and will be supported for the years to come, but in its wake
lies Angular 2—a wholly different animal built for the future of client-side computing. Angular
2 abandons antipatterns by the fistful and, instead, is reshaped into a precise and elegant
software instrument. It embraces the impending renaissance of web technologies, building
atop ES6, web components, web workers, TypeScript, and reactive programming, to name a
few. It brings framework modularity to new heights, building itself around the concept that any
modular piece of Angular 2 should be easily discarded or replaced. Best of all, Angular 2 offers
a bountiful collection of configuration and tooling that will make your applications run at
breakneck speed.
To many developers, Angular 2 is frightening because so much of it is new and unfamiliar. This
book exists to offer you an approachable path to a full understanding of Angular 2, what it
offers, and how best to use it. You will find both simple examples to set a foundational
understanding, and complex demonstrations to hint at the framework's power. The book is
organized into recipes that are independent of each other, so you are able to jump in at any
point and immediately begin learning.
What this book covers
This book is up to date for the 2.4 release and is compatible through the 4.0 release as well,
and it does not have any code based on the beta or release candidates.
Chapter 1, Strategies for Upgrading to Angular 2, is an overview of a number of ways to
migrate an Angular 1 application to Angular 2. Although there is no one-size-fits-all upgrade
strategy, you will find that these recipes demonstrate some ways that will allow you to
preserve a large amount of your existing Angular 1 code base.
Chapter 2, Conquering Components and Directives, gives a broad and deep set of examples
involving what Angular 2 components are and how to use them. Angular 2 applications are
built entirely of components, and this chapter offers you a total rundown of their role.